package com.fupan.Direct;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class DirectConfig {


    //路由类型的交换机
    @Bean
    public DirectExchange directExchange(){
        return new DirectExchange("directExchange");
    }


    @Bean
    public Queue directQueueQuery(){
        return new Queue("directQueueQuery");
    }


    @Bean
    public Queue directQueueAddDelUpdate(){
        return new Queue("directQueueAddDelUpdate");
    }

    @Bean
    public Binding queryBinding(){
        return BindingBuilder.bind(directQueueQuery())
                .to(directExchange())
                .with("query");
    }

    @Bean
    public Binding addBinding(){
        return BindingBuilder.bind(directQueueAddDelUpdate())
                .to(directExchange())
                .with("add");
    }


    @Bean
    public Binding deleteBinding(){
        return BindingBuilder.bind(directQueueAddDelUpdate())
                .to(directExchange())
                .with("delete");
    }


    @Bean
    public Binding updateBinding(){
        return BindingBuilder.bind(directQueueAddDelUpdate())
                .to(directExchange())
                .with("update");
    }
}